/*!
 * @file window_test.cpp
 * @brief Unit tests of dsp++/window.h artifacts.
 * @author Andrzej Ciarkowski <mailto:andrzej.ciarkowski@gmail.com>
 */
#include <dsp++/float.h>
#include "window_test.h"
#include <algorithm>
#include <boost/scoped_ptr.hpp>
#include <dsp++/window.h>

using namespace dsp::test;

template<template<class> class Window, class Real, size_t N>
bool verify_window(const Real (& ref)[N], Real margin = Real(), const Window<Real>& wnd = Window<Real>(N))
{
	return std::equal(wnd.begin(), wnd.end(), ref, dsp::within_range<Real>(std::numeric_limits<Real>::epsilon() * margin));
}


void window_test::test_rectwin()
{
	const size_t n = 256;
	float ref[n];
	std::fill_n(ref, n, 1.f);
	CPPUNIT_ASSERT(verify_window<dsp::wnd::rectwin>(ref));

	double dref[n];
	std::fill_n(dref, n, 1.);
	CPPUNIT_ASSERT(verify_window<dsp::wnd::rectwin>(dref));
}

const float hamming128f[] =
	{0.07999999821186066,0.08056284487247467,0.08225001394748688,0.08505737781524658,0.08897805958986282,0.09400246292352676,0.1001183018088341,0.1073106005787849,0.11556176841259,0.1248515993356705,0.1351573765277863,0.1464538723230362,0.1587134301662445,0.1719060689210892,0.1859994977712631,0.2009592205286026,0.2167486250400543,0.2333290874958038,0.2506600320339203,0.2686990201473236,0.28740194439888,0.306723028421402,0.3266149461269379,0.3470290899276733,0.3679154515266419,0.3892229199409485,0.4108993709087372,0.4328917562961578,0.4551462531089783,0.4776084125041962,0.5002232193946838,0.5229354500770569,0.5456893444061279,0.5684293508529663,0.5910997986793518,0.6136451959609985,0.6360103487968445,0.6581405401229858,0.6799816489219666,0.7014802098274231,0.7225835919380188,0.7432401776313782,0.7633993625640869,0.7830118536949158,0.8020296692848206,0.8204062581062317,0.8380966186523438,0.8550575375556946,0.871247410774231,0.8866267204284668,0.9011577367782593,0.9148049354553223,0.9275349378585815,0.9393165707588196,0.9501209855079651,0.9599217772483826,0.9686949849128723,0.9764190912246704,0.9830752015113831,0.9886469841003418,0.9931209087371826,0.9964859485626221,0.9987339377403259,0.9998592734336853,0.9998592734336853,0.9987339377403259,0.9964859485626221,0.9931209087371826,0.9886469841003418,0.9830752015113831,0.9764190912246704,0.9686949849128723,0.9599217772483826,0.9501209855079651,0.9393165707588196,0.9275349378585815,0.9148049354553223,0.9011577367782593,0.8866267204284668,0.871247410774231,0.8550575375556946,0.8380966186523438,0.8204062581062317,0.8020296692848206,0.7830118536949158,0.7633993625640869,0.7432401776313782,0.7225835919380188,0.7014802098274231,0.6799816489219666,0.6581405401229858,0.6360103487968445,0.6136451959609985,0.5910997986793518,0.5684293508529663,0.5456893444061279,0.5229354500770569,0.5002232193946838,0.4776084125041962,0.4551462531089783,0.4328917562961578,0.4108993709087372,0.3892229199409485,0.3679154515266419,0.3470290899276733,0.3266149461269379,0.306723028421402,0.28740194439888,0.2686990201473236,0.2506600320339203,0.2333290874958038,0.2167486250400543,0.2009592205286026,0.1859994977712631,0.1719060689210892,0.1587134301662445,0.1464538723230362,0.1351573765277863,0.1248515993356705,0.11556176841259,0.1073106005787849,0.1001183018088341,0.09400246292352676,0.08897805958986282,0.08505737781524658,0.08225001394748688,0.08056284487247467,0.07999999821186066};
const double hamming128d[] =
	{0.08000000000000002,0.0805628485414398,0.08225001678106098,0.08505737593545987,0.08897805592635238,0.09400246219280656,0.1001182991707413,0.1073106003822318,0.1155617650609889,0.1248516012243839,0.1351573750866134,0.1464538666920827,0.1587134316328634,0.1719060686991922,0.1859994932974579,0.2009592164560126,0.2167486292254645,0.2333290922669115,0.2506600304088785,0.268699031941561,0.2874019524053867,0.3067230226199044,0.3266149606886389,0.3470290877058147,0.3679154468817951,0.3892229257957187,0.4108993814761572,0.432891768003705,0.4551462663232323,0.4776084159481323,0.500223248234257,0.5229354208974016,0.5456893534451469,0.5684293631916386,0.5910998015224501,0.6136451900760669,0.6360103565087342,0.6581405695104272,0.6799816727415387,0.7014802173625157,0.722583592832128,0.7432401556542779,0.7633993557582885,0.7830118602033986,0.8020296739047343,0.8204062570853257,0.8380966391667385,0.8550575288196161,0.8712474199048161,0.8866266930458899,0.9011577125843333,0.9148049186803513,0.9275349143337445,0.9393165471119649,0.9501209853853385,0.9599217888828946,0.9686949733961399,0.9764190694724346,0.9830751749543423,0.9886470012363748,0.9931209131259411,0.9964859622109474,0.9987339136523965,0.9998592663364183,0.9998592663364183,0.9987339136523965,0.9964859622109474,0.9931209131259411,0.9886470012363748,0.9830751749543423,0.9764190694724346,0.9686949733961399,0.9599217888828946,0.9501209853853385,0.9393165471119649,0.9275349143337445,0.9148049186803513,0.9011577125843333,0.8866266930458899,0.8712474199048161,0.8550575288196161,0.8380966391667385,0.8204062570853257,0.8020296739047343,0.7830118602033986,0.7633993557582885,0.7432401556542779,0.722583592832128,0.7014802173625157,0.6799816727415387,0.6581405695104272,0.6360103565087342,0.6136451900760669,0.5910998015224501,0.5684293631916386,0.5456893534451469,0.5229354208974016,0.500223248234257,0.4776084159481323,0.4551462663232323,0.432891768003705,0.4108993814761572,0.3892229257957187,0.3679154468817951,0.3470290877058147,0.3266149606886389,0.3067230226199044,0.2874019524053867,0.268699031941561,0.2506600304088785,0.2333290922669115,0.2167486292254645,0.2009592164560126,0.1859994932974579,0.1719060686991922,0.1587134316328634,0.1464538666920827,0.1351573750866134,0.1248516012243839,0.1155617650609889,0.1073106003822318,0.1001182991707413,0.09400246219280656,0.08897805592635238,0.08505737593545987,0.08225001678106098,0.0805628485414398,0.08000000000000002};

void window_test::test_hamming()
{
	CPPUNIT_ASSERT(verify_window<dsp::wnd::hamming>(hamming128f, 3.f));
	CPPUNIT_ASSERT(verify_window<dsp::wnd::hamming>(hamming128d, 3.));
}

const float hann128f[] =
	{0,0.0006117919110693038,0.002445670310407877,0.005497147794812918,0.009758756496012211,0.01522006746381521,0.02186771668493748,0.02968543581664562,0.03865409269928932,0.04875174164772034,0.05995366722345352,0.07223246246576309,0.08555807918310165,0.09989789873361588,0.1152168437838554,0.131477415561676,0.1486398130655289,0.1666620522737503,0.1855000257492065,0.205107644200325,0.2254369109869003,0.2464380711317062,0.2680597305297852,0.2902490198612213,0.3129515647888184,0.3361118733882904,0.3596732318401337,0.3835780024528503,0.4077676832675934,0.4321830570697784,0.4567644000053406,0.481451541185379,0.5061841011047363,0.5309014916419983,0.5555432438850403,0.5800490975379944,0.6043590903282166,0.6284136772155762,0.6521539688110352,0.6755219697952271,0.6984604001045227,0.7209132313728333,0.7428253889083862,0.7641433477401733,0.7848148345947266,0.8047894239425659,0.8240180611610413,0.8424538373947144,0.8600515723228455,0.876768171787262,0.8925627470016479,0.907396674156189,0.921233594417572,0.9340397119522095,0.9457836747169495,0.9564367532730103,0.9659727811813354,0.9743685722351074,0.9816034436225891,0.9876598119735718,0.9925227165222168,0.9961804151535034,0.9986238479614258,0.9998470544815063,0.9998470544815063,0.9986238479614258,0.9961804151535034,0.9925227165222168,0.9876598119735718,0.9816034436225891,0.9743685722351074,0.9659727811813354,0.9564367532730103,0.9457836747169495,0.9340397119522095,0.921233594417572,0.907396674156189,0.8925627470016479,0.876768171787262,0.8600515723228455,0.8424538373947144,0.8240180611610413,0.8047894239425659,0.7848148345947266,0.7641433477401733,0.7428253889083862,0.7209132313728333,0.6984604001045227,0.6755219697952271,0.6521539688110352,0.6284136772155762,0.6043590903282166,0.5800490975379944,0.5555432438850403,0.5309014916419983,0.5061841011047363,0.481451541185379,0.4567644000053406,0.4321830570697784,0.4077676832675934,0.3835780024528503,0.3596732318401337,0.3361118733882904,0.3129515647888184,0.2902490198612213,0.2680597305297852,0.2464380711317062,0.2254369109869003,0.205107644200325,0.1855000257492065,0.1666620522737503,0.1486398130655289,0.131477415561676,0.1152168437838554,0.09989789873361588,0.08555807918310165,0.07223246246576309,0.05995366722345352,0.04875174164772034,0.03865409269928932,0.02968543581664562,0.02186771668493748,0.01522006746381521,0.009758756496012211,0.005497147794812918,0.002445670310407877,0.0006117919110693038,0};
const double hann128d[] =
	{0,0.0006117918928693622,0.002445670414196688,0.005497147755934628,0.009758756441687333,0.01522006760087674,0.02186771648993624,0.02968543519807804,0.03865409245759666,0.04875174046128689,0.0599536685724058,0.072232463795742,0.08555807786180808,0.0998979007599915,0.1152168405407151,0.131477409191318,0.1486398143755049,0.1666620568118603,0.1855000330531287,0.2051076434147402,0.2254369047884638,0.2464380680651134,0.2680597398789553,0.2902490083758854,0.3129515726976034,0.3361118758649116,0.3596732407349535,0.3835780086996792,0.407767680786122,0.4321830608131872,0.456764400254627,0.4814515444536973,0.5061840798316815,0.5309014817300421,0.5555432625244022,0.5800491196478987,0.6043590831616675,0.6284136625113339,0.652153992110368,0.6755219753940388,0.6984604269914436,0.7209132126676934,0.7428253866937918,0.7641433263080417,0.7848148629399285,0.8047894098753539,0.8240180860508024,0.8424538356734956,0.8600515433748002,0.8767681446150977,0.8925627310699275,0.9073966507395121,0.9212336025366787,0.9340397251217009,0.9457836797666721,0.9564367270466247,0.9659727971697173,0.9743685537743855,0.9816034510373286,0.9876597839525814,0.9925227316586316,0.9961803937075515,0.9986238191873873,0.9998470286265415,0.9998470286265415,0.9986238191873873,0.9961803937075515,0.9925227316586317,0.9876597839525814,0.9816034510373285,0.9743685537743856,0.9659727971697173,0.9564367270466246,0.9457836797666723,0.934039725121701,0.9212336025366787,0.9073966507395124,0.8925627310699273,0.8767681446150978,0.8600515433748003,0.8424538356734955,0.8240180860508027,0.8047894098753541,0.7848148629399286,0.7641433263080418,0.7428253866937918,0.7209132126676936,0.6984604269914438,0.6755219753940389,0.6521539921103682,0.628413662511334,0.6043590831616675,0.5800491196478992,0.5555432625244026,0.5309014817300419,0.5061840798316817,0.4814515444536975,0.4567644002546272,0.4321830608131872,0.407767680786122,0.3835780086996792,0.3596732407349533,0.3361118758649119,0.3129515726976036,0.2902490083758852,0.2680597398789554,0.2464380680651135,0.2254369047884638,0.2051076434147405,0.185500033053129,0.1666620568118602,0.1486398143755051,0.1314774091913181,0.1152168405407151,0.09989790075999172,0.08555807786180802,0.07223246379574194,0.05995366857240592,0.04875174046128694,0.03865409245759671,0.02968543519807826,0.02186771648993624,0.01522006760087669,0.009758756441687388,0.005497147755934684,0.002445670414196743,0.0006117918928693622,0};

void window_test::test_hann()
{
	CPPUNIT_ASSERT(verify_window<dsp::wnd::hann>(hann128f, 3.f));
	CPPUNIT_ASSERT(verify_window<dsp::wnd::hann>(hann128d, 3.));
}

const float blackman128f[] =
	{-1.38777878078144567552954e-17,0.00022048462659787770867581,0.000884269383526703478537456,0.0019983131175448226590774,0.00357410164847185574110711,0.0056274806292917478600657,0.00817842403204693813023596,0.0112507407115636087757693,0.0148717221575158584090381,0.0190717351727862707844174,0.0238837638062515955628129,0.0293429054151091300850496,0.0354858262301915236558436,0.0423501822423988788512972,0.0499740116149355317887171,0.0583951051505777612993242,0.0676503616024358434000163,0.0777751348079559201575961,0.0888025797472619116135206,0.100763004677081338678057,0.113683236469832749104825,0.127586006194106704736413,0.142489361808566750156047,0.158406114607757081413908,0.17534332575763533768054,0.193301838893723237911004,0.212275864329084823500793,0.232252619937011711703789,0.253212033238967237913641,0.275126508647214607083953,0.297960763189246025106627,0.321671733383715352516674,0.346208555251434790811516,0.371512618736833721833079,0.397517697091989252733413,0.424150151043997114541639,0.451329206834207630194555,0.478967306491861810613386,0.506970527992046005039128,0.535239072255623060669905,0.563667813283684204783697,0.592146907087636620303783,0.620562454484505199303612,0.648797212281210899931239,0.676731346876882189356195,0.704243223873540435953089,0.731210226907138771679229,0.757509598596688871197102,0.783019296262208452930054,0.807618854884987746878267,0.83119024967797883185483,0.853618750601126130561624,0.874793761196536956425973,0.894609634231282702110377,0.91296645682031385415911,0.929770797956726902100399,0.944936411699106471040466,0.958384889652786897684678,0.970046256830009778759916,0.979859505478775427711469,0.987773062026939152602267,0.993745182891411116266056,0.997744275546437853208204,0.999749141923682471677637,0.999749141923682471677637,0.997744275546437853208204,0.993745182891411227288359,0.98777306202693926362457,0.979859505478775427711469,0.970046256830009778759916,0.958384889652786897684678,0.944936411699106471040466,0.929770797956727013122702,0.91296645682031385415911,0.89460963423128281313268,0.874793761196537289492881,0.853618750601126352606229,0.831190249677978720832527,0.807618854884987857900569,0.783019296262208785996961,0.757509598596688982219405,0.731210226907138993723834,0.704243223873540546975391,0.676731346876882522423102,0.648797212281210899931239,0.62056245448450508828131,0.592146907087636509281481,0.563667813283684537850604,0.535239072255623393736812,0.506970527992046227083733,0.478967306491861921635689,0.451329206834208129794916,0.424150151043997003519337,0.39751769709198914171111,0.371512618736833610810777,0.34620855525143501285612,0.321671733383715463538977,0.297960763189246136128929,0.275126508647214607083953,0.2532120332389676264917,0.232252619937011683948214,0.212275864329084795745217,0.193301838893723348933307,0.175343325757635504213994,0.158406114607757136925059,0.142489361808566805667198,0.127586006194106760247564,0.113683236469833012782793,0.100763004677081310922482,0.0888025797472618561023694,0.077775134807956072813262,0.0676503616024359544223188,0.0583951051505777266048547,0.0499740116149355664831866,0.0423501822423990176291753,0.0354858262301915722281009,0.0293429054151091092683679,0.0238837638062515747461312,0.0190717351727862777233113,0.0148717221575158792257199,0.0112507407115636504091327,0.00817842403204693813023596,0.00562748062929178949342912,0.00357410164847186961889491,0.0019983131175448226590774,0.00088426938352674511190088,0.000220484626597863830888002,-1.38777878078144567552954e-17};
const double blackman128d[] =
	{-1.387778780781446e-17,0.0002204846265978777,0.0008842693835267035,0.001998313117544823,0.003574101648471856,0.005627480629291748,0.008178424032046938,0.01125074071156361,0.01487172215751586,0.01907173517278627,0.0238837638062516,0.02934290541510913,0.03548582623019152,0.04235018224239888,0.04997401161493553,0.05839510515057776,0.06765036160243584,0.07777513480795592,0.08880257974726191,0.1007630046770813,0.1136832364698327,0.1275860061941067,0.1424893618085668,0.1584061146077571,0.1753433257576353,0.1933018388937232,0.2122758643290848,0.2322526199370117,0.2532120332389672,0.2751265086472146,0.297960763189246,0.3216717333837154,0.3462085552514348,0.3715126187368337,0.3975176970919893,0.4241501510439971,0.4513292068342076,0.4789673064918618,0.506970527992046,0.5352390722556231,0.5636678132836842,0.5921469070876366,0.6205624544845052,0.6487972122812109,0.6767313468768822,0.7042432238735404,0.7312102269071388,0.7575095985966889,0.7830192962622085,0.8076188548849877,0.8311902496779788,0.8536187506011261,0.874793761196537,0.8946096342312827,0.9129664568203139,0.9297707979567269,0.9449364116991065,0.9583848896527869,0.9700462568300098,0.9798595054787754,0.9877730620269392,0.9937451828914111,0.9977442755464379,0.9997491419236825,0.9997491419236825,0.9977442755464379,0.9937451828914112,0.9877730620269393,0.9798595054787754,0.9700462568300098,0.9583848896527869,0.9449364116991065,0.929770797956727,0.9129664568203139,0.8946096342312828,0.8747937611965373,0.8536187506011264,0.8311902496779787,0.8076188548849879,0.7830192962622088,0.757509598596689,0.731210226907139,0.7042432238735405,0.6767313468768825,0.6487972122812109,0.6205624544845051,0.5921469070876365,0.5636678132836845,0.5352390722556234,0.5069705279920462,0.4789673064918619,0.4513292068342081,0.424150151043997,0.3975176970919891,0.3715126187368336,0.346208555251435,0.3216717333837155,0.2979607631892461,0.2751265086472146,0.2532120332389676,0.2322526199370117,0.2122758643290848,0.1933018388937233,0.1753433257576355,0.1584061146077571,0.1424893618085668,0.1275860061941068,0.113683236469833,0.1007630046770813,0.08880257974726186,0.07777513480795607,0.06765036160243595,0.05839510515057773,0.04997401161493557,0.04235018224239902,0.03548582623019157,0.02934290541510911,0.02388376380625157,0.01907173517278628,0.01487172215751588,0.01125074071156365,0.008178424032046938,0.005627480629291789,0.00357410164847187,0.001998313117544823,0.0008842693835267451,0.0002204846265978638,-1.387778780781446e-17};

void window_test::test_blackman()
{
	CPPUNIT_ASSERT(verify_window<dsp::wnd::blackman>(blackman128f, 3.f));
	CPPUNIT_ASSERT(verify_window<dsp::wnd::blackman>(blackman128d, 3.));
}

const float gausswin128f[] =
	{0.0461267344653606414794922,0.0507810376584529876708984,0.0558197386562824249267578,0.0612648427486419677734375,0.0671385824680328369140625,0.0734632834792137145996094,0.08026123046875,0.0875545293092727661132812,0.0953649431467056274414062,0.103713713586330413818359,0.112621411681175231933594,0.122107699513435363769531,0.132191166281700134277344,0.142889112234115600585938,0.154217332601547241210938,0.166189879179000854492188,0.17881882190704345703125,0.192114099860191345214844,0.20608317852020263671875,0.220730930566787719726562,0.23605930805206298828125,0.252067238092422485351562,0.268750339746475219726562,0.286100685596466064453125,0.304106801748275756835938,0.32275331020355224609375,0.342020839452743530273438,0.361885994672775268554688,0.382321089506149291992188,0.4032943248748779296875,0.424769431352615356445312,0.446705907583236694335938,0.469059020280838012695312,0.491779714822769165039062,0.514814794063568115234375,0.5381071567535400390625,0.56159579753875732421875,0.585216045379638671875,0.608899891376495361328125,0.63257634639739990234375,0.656171381473541259765625,0.67960870265960693359375,0.70280992984771728515625,0.725695133209228515625,0.748182952404022216796875,0.77019155025482177734375,0.791638672351837158203125,0.81244242191314697265625,0.832521498203277587890625,0.85179615020751953125,0.870188236236572265625,0.88762199878692626953125,0.904024541378021240234375,0.919326364994049072265625,0.93346178531646728515625,0.946369349956512451171875,0.957992494106292724609375,0.968279778957366943359375,0.97718536853790283203125,0.984669208526611328125,0.99069750308990478515625,0.99524295330047607421875,0.998284876346588134765625,0.99980926513671875,0.99980926513671875,0.998284876346588134765625,0.99524295330047607421875,0.99069750308990478515625,0.984669208526611328125,0.97718536853790283203125,0.968279778957366943359375,0.957992494106292724609375,0.946369349956512451171875,0.93346178531646728515625,0.919326364994049072265625,0.904024541378021240234375,0.88762199878692626953125,0.870188236236572265625,0.85179615020751953125,0.832521498203277587890625,0.81244242191314697265625,0.791638672351837158203125,0.77019155025482177734375,0.748182952404022216796875,0.725695133209228515625,0.70280992984771728515625,0.67960870265960693359375,0.656171381473541259765625,0.63257634639739990234375,0.608899891376495361328125,0.585216045379638671875,0.56159579753875732421875,0.5381071567535400390625,0.514814794063568115234375,0.491779714822769165039062,0.469059020280838012695312,0.446705907583236694335938,0.424769431352615356445312,0.4032943248748779296875,0.382321089506149291992188,0.361885994672775268554688,0.342020839452743530273438,0.32275331020355224609375,0.304106801748275756835938,0.286100685596466064453125,0.268750339746475219726562,0.252067238092422485351562,0.23605930805206298828125,0.220730930566787719726562,0.20608317852020263671875,0.192114099860191345214844,0.17881882190704345703125,0.166189879179000854492188,0.154217332601547241210938,0.142889112234115600585938,0.132191166281700134277344,0.122107699513435363769531,0.112621411681175231933594,0.103713713586330413818359,0.0953649431467056274414062,0.0875545293092727661132812,0.08026123046875,0.0734632834792137145996094,0.0671385824680328369140625,0.0612648427486419677734375,0.0558197386562824249267578,0.0507810376584529876708984,0.0461267344653606414794922};
const double gausswin128d[] =
	{0.0461267327992679609938165,0.0507810391693065202312063,0.0558197378861909204728065,0.0612648424437734831493607,0.0671385825891517989960633,0.073463283377888086156382,0.0802612317796436991468312,0.0875545309183389519613883,0.0953649421769246774527318,0.103713715553632540578022,0.112621408822916865832831,0.122107696228706805174902,0.13219116761828256234601,0.14288911911004611998699,0.15421733657540187545365,0.166189873401396182028833,0.178818824183986063713903,0.192114096178942150849878,0.206083180505429508500015,0.220730925253149135034647,0.236059312784410779695321,0.252067243644494620724572,0.268750329594055425985744,0.286100698353154381248231,0.304106812694969863564154,0.322753306545778106961819,0.34202084073414384945977,0.361885980984508082158868,0.382321100667011082308022,0.403294310695411439837699,0.424769418807832699336302,0.446705920270823064743837,0.469059021816459253972909,0.491779700356184401588422,0.514814797715576588643671,0.538107152303759828093632,0.561595768272757478456469,0.585216022339406505281545,0.608899908039713833041162,0.632576316767458290968307,0.656171354520607041926894,0.679608692846262796294354,0.70280995204327123548893,0.725695114257354001452427,0.748182963692910263375779,0.770191550774657840428006,0.791638676727209777972405,0.812442394707452830715511,0.832521523328844548217376,0.851796168163739930712097,0.87018824660431493001056,0.887622011308722314026909,0.904024567360236841473409,0.919326378226020035633326,0.933461755620600519556262,0.94636932845823029669674,0.957992486217995597996833,0.968279792245081427637388,0.977185362769118492920484,0.984669207733377627178584,0.990697529893118544741526,0.995242979053225340635436,0.99828485876917172348044,0.999809283325456377156115,0.999809283325456377156115,0.99828485876917172348044,0.995242979053225340635436,0.990697529893118544741526,0.984669207733377627178584,0.977185362769118492920484,0.968279792245081427637388,0.957992486217995597996833,0.94636932845823029669674,0.933461755620600519556262,0.919326378226020035633326,0.904024567360236841473409,0.887622011308722314026909,0.87018824660431493001056,0.851796168163739930712097,0.832521523328844548217376,0.812442394707452830715511,0.791638676727209777972405,0.770191550774657840428006,0.748182963692910263375779,0.725695114257354001452427,0.70280995204327123548893,0.679608692846262796294354,0.656171354520607041926894,0.632576316767458290968307,0.608899908039713833041162,0.585216022339406505281545,0.561595768272757478456469,0.538107152303759828093632,0.514814797715576588643671,0.491779700356184401588422,0.469059021816459253972909,0.446705920270823064743837,0.424769418807832699336302,0.403294310695411439837699,0.382321100667011082308022,0.361885980984508082158868,0.34202084073414384945977,0.322753306545778106961819,0.304106812694969863564154,0.286100698353154381248231,0.268750329594055425985744,0.252067243644494620724572,0.236059312784410779695321,0.220730925253149135034647,0.206083180505429508500015,0.192114096178942150849878,0.178818824183986063713903,0.166189873401396182028833,0.15421733657540187545365,0.14288911911004611998699,0.13219116761828256234601,0.122107696228706805174902,0.112621408822916865832831,0.103713715553632540578022,0.0953649421769246774527318,0.0875545309183389519613883,0.0802612317796436991468312,0.073463283377888086156382,0.0671385825891517989960633,0.0612648424437734831493607,0.0558197378861909204728065,0.0507810391693065202312063,0.0461267327992679609938165};

void window_test::test_gausswin()
{
	CPPUNIT_ASSERT(verify_window<dsp::wnd::gausswin>(gausswin128f, 3.f));
	CPPUNIT_ASSERT(verify_window<dsp::wnd::gausswin>(gausswin128d, 3.));
}

const float kaiser128f[] =
	{0.000612335919868201017379761,0.00111689325422048568725586,0.00179402704816311597824097,0.00267595611512660980224609,0.00379777885973453521728516,0.00519739557057619094848633,0.00691538630053400993347168,0.00899484474211931228637695,0.011481164023280143737793,0.0144217731431126594543457,0.0178658291697502136230469,0.0218638591468334197998047,0.0264673605561256408691406,0.0317283533513545989990234,0.0376988984644412994384766,0.0444305688142776489257812,0.0519738942384719848632812,0.0603777840733528137207031,0.0696889087557792663574219,0.0799511000514030456542969,0.0912046805024147033691406,0.103485859930515289306641,0.116826102137565612792969,0.131251484155654907226562,0.146782115101814270019531,0.163431569933891296386719,0.18120634555816650390625,0.200105354189872741699219,0.220119506120681762695312,0.241231366991996765136719,0.26341474056243896484375,0.286634504795074462890625,0.31084644794464111328125,0.335997164249420166015625,0.362024009227752685546875,0.388855308294296264648438,0.4164104461669921875,0.444600135087966918945312,0.473326861858367919921875,0.502485334873199462890625,0.531962871551513671875,0.56164038181304931640625,0.5913927555084228515625,0.621089756488800048828125,0.65059697628021240234375,0.679776668548583984375,0.70848882198333740234375,0.736591994762420654296875,0.763944685459136962890625,0.790406167507171630859375,0.815837681293487548828125,0.840103626251220703125,0.863072454929351806640625,0.88461792469024658203125,0.904620230197906494140625,0.922966659069061279296875,0.93955290317535400390625,0.954283893108367919921875,0.96707439422607421875,0.9778499603271484375,0.98654758930206298828125,0.993116199970245361328125,0.997516930103302001953125,0.999723851680755615234375,0.999723851680755615234375,0.997516930103302001953125,0.993116199970245361328125,0.98654758930206298828125,0.9778499603271484375,0.96707439422607421875,0.954283893108367919921875,0.93955290317535400390625,0.922966659069061279296875,0.904620230197906494140625,0.88461792469024658203125,0.863072454929351806640625,0.840103626251220703125,0.815837681293487548828125,0.790406167507171630859375,0.763944685459136962890625,0.736591994762420654296875,0.70848882198333740234375,0.679776668548583984375,0.65059697628021240234375,0.621089756488800048828125,0.5913927555084228515625,0.56164038181304931640625,0.531962871551513671875,0.502485334873199462890625,0.473326861858367919921875,0.444600135087966918945312,0.4164104461669921875,0.388855308294296264648438,0.362024009227752685546875,0.335997164249420166015625,0.31084644794464111328125,0.286634504795074462890625,0.26341474056243896484375,0.241231366991996765136719,0.220119506120681762695312,0.200105354189872741699219,0.18120634555816650390625,0.163431569933891296386719,0.146782115101814270019531,0.131251484155654907226562,0.116826102137565612792969,0.103485859930515289306641,0.0912046805024147033691406,0.0799511000514030456542969,0.0696889087557792663574219,0.0603777840733528137207031,0.0519738942384719848632812,0.0444305688142776489257812,0.0376988984644412994384766,0.0317283533513545989990234,0.0264673605561256408691406,0.0218638591468334197998047,0.0178658291697502136230469,0.0144217731431126594543457,0.011481164023280143737793,0.00899484474211931228637695,0.00691538630053400993347168,0.00519739557057619094848633,0.00379777885973453521728516,0.00267595611512660980224609,0.00179402704816311597824097,0.00111689325422048568725586,0.000612335919868201017379761};
const double kaiser128d[] =
	{0.000612335927796156618413415,0.00111689329607919554492035,0.00179402708978791940869213,0.00267595621116773667649835,0.00379777893185251130478419,0.00519739541418763693197969,0.00691538620877881361065365,0.00899484496799449716186725,0.0114811641628066746917414,0.0144217731860963385703833,0.0178658288623725937382947,0.0218638590538192852108512,0.0264673607469129781866179,0.0317283547130500498401062,0.037698899550586723039558,0.0444305686238844962931971,0.0519738941065313736489273,0.060377782999896822957453,0.06968891062365251132249,0.0799510976511257076548844,0.0912046772790295889876688,0.103485859568465524138681,0.11682610036309597212334,0.131251482472908409526724,0.146782117000953754581971,0.163431572779949185747483,0.18120634187109599388954,0.200105348955725598214528,0.220119512219746821246602,0.241231362991255693373205,0.263414730944524777545013,0.286634501132080499186117,0.310846448455335766514196,0.335997154439625911326317,0.362024010349221214699611,0.388855309771215018610491,0.416410432824564635811981,0.444600123123790158530255,0.473326857558506175482904,0.502485307853777318776167,0.531962891766401213544668,0.561640410663399314294963,0.591392769136173557242842,0.621089771241995936001956,0.650596986948546840423546,0.679776681401526694514814,0.708488798753720061540662,0.736591991499330189796524,0.763944685561659952988123,0.790406170796287943502989,0.815837706104752258262636,0.840103628013463388235493,0.863072451365011539259342,0.884617950698585842062016,0.904620210965353388488097,0.922966636433854459298232,0.939552906988286973266611,0.954283871505835046278321,0.96707436861241713454973,0.977849965852688018941308,0.986547609160634220160091,0.993116175471601803081967,0.997516922362848057481699,0.999723829734840530036877,0.999723829734840530036877,0.997516922362848057481699,0.993116175471601803081967,0.986547609160634220160091,0.977849965852688018941308,0.96707436861241713454973,0.954283871505835046278321,0.939552906988286973266611,0.922966636433854459298232,0.904620210965353388488097,0.884617950698585842062016,0.863072451365011539259342,0.840103628013463388235493,0.815837706104752258262636,0.790406170796287943502989,0.763944685561659952988123,0.736591991499330189796524,0.708488798753720061540662,0.679776681401526694514814,0.650596986948546840423546,0.621089771241995936001956,0.591392769136173557242842,0.561640410663399314294963,0.531962891766401213544668,0.502485307853777318776167,0.473326857558506175482904,0.444600123123790158530255,0.416410432824564635811981,0.388855309771215018610491,0.362024010349221214699611,0.335997154439625911326317,0.310846448455335766514196,0.286634501132080499186117,0.263414730944524777545013,0.241231362991255693373205,0.220119512219746821246602,0.200105348955725598214528,0.18120634187109599388954,0.163431572779949185747483,0.146782117000953754581971,0.131251482472908409526724,0.11682610036309597212334,0.103485859568465524138681,0.0912046772790295889876688,0.0799510976511257076548844,0.06968891062365251132249,0.060377782999896822957453,0.0519738941065313736489273,0.0444305686238844962931971,0.037698899550586723039558,0.0317283547130500498401062,0.0264673607469129781866179,0.0218638590538192852108512,0.0178658288623725937382947,0.0144217731860963385703833,0.0114811641628066746917414,0.00899484496799449716186725,0.00691538620877881361065365,0.00519739541418763693197969,0.00379777893185251130478419,0.00267595621116773667649835,0.00179402708978791940869213,0.00111689329607919554492035,0.000612335927796156618413415};

void window_test::test_kaiser()
{
	CPPUNIT_ASSERT(verify_window<dsp::wnd::kaiser>(kaiser128f, 4.f));
	CPPUNIT_ASSERT(verify_window<dsp::wnd::kaiser>(kaiser128d, 7.));
}

